package baza.games.airSoccer;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public class Traves implements IDrawableComponent {

	PosicoesCampo posicaoCampo;
	int x1, y1, x2, y2;
	private AirSoccerEngine currEngine;
	
	
	public Traves(PosicoesCampo posicao)
	{
		this.posicaoCampo = posicao;
		if( posicao == PosicoesCampo.Cima)
		{
			x1=AirSoccerEngine.netWidth/3;
			y1=0;
			x2=(2*AirSoccerEngine.netWidth)/3;
			y2=0;
		}
		else
		{
			x1=AirSoccerEngine.netWidth/3;
			y1=-1;
			x2=(2*AirSoccerEngine.netWidth)/3;
			y2=-1;
		}
	}
	
	public void draw(Canvas canvas) {
		Paint paint = new Paint();
		
		paint.setColor(Color.BLACK);
		paint.setStrokeWidth(12);
		if(y1 == -1 || y2 == -1 )
		{
			y1 = canvas.getHeight();
			y2 = canvas.getHeight();
		}
		canvas.drawLine(x1, y1, x2 ,y2, paint);
	}

	public void update() {
		// TODO Auto-generated method stub
		
	}

	public void setEngine(AirSoccerEngine engine) {
		this.currEngine = engine;
		
	}

}
